function checkRegisterForm() {
    var userName = document.getElementById('regName').value;
    var phoneNum = document.getElementById('phoneNum').value;
    var eMail = document.getElementById('eMail').value;
    var password = document.getElementById('regPassword').value;
    var pwdRepeat = document.getElementById('pwdRepeat').value;

    // check userName
    var re_userName = /^[\w]{4,16}$/;

    if (!re_userName.test(userName)) {
        alert("对不起，请输入4到16位的数字，大小字母，下划线的用户名！");
        return false;
    }

    // check phoneNum
    var re_phoneNum = /^1[34578]\d{9}$/;

    if (!re_phoneNum.test(phoneNum)) {
        alert("请输入正确的手机号码！");
        return false;
    }

    // check eMail
    var re_eMail = /^[a-zA-Z0-9_\-]+\@[a-zA-Z0-9\-]+\.([a-zA-z0-9]{2,4})+$/;

    if (!re_eMail.test(eMail)) {
        alert("邮箱地址格式不合法！");
        return false;
    }

    // check password
    var re_password = /^\w{6,20}$/;

    if (!re_password.test(password)) {
        alert("密码格式不正确，建议使用数字、字母、下划线的组合，6-20位字符！");
        return false;
    }
    
    //check pwdRepeat
    if (password != pwdRepeat) {
        alert("确认密码输入错误！");
        return false;
    }

    return true;
}